package androidx.appcompat.widget;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.ClassLoaderCreator;
import android.os.Parcelable.Creator;
import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
import android.view.ContextThemeWrapper;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.ViewParent;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.StringRes;
import androidx.annotation.StyleRes;
import androidx.appcompat.widget.ActionMenuView.c;
import androidx.core.view.ViewCompat;
import androidx.customview.view.AbsSavedState;
import java.util.ArrayList;
import java.util.List;
import o.ah;
import o.ah.g;
import o.ar;
import o.at;
import o.bd;
import o.bj;
import o.bn;
import o.bn.d;
import o.bv;
import o.ck;
import o.cv;
import o.cw;
import o.cx;
import o.de;
import o.hi;
import o.hj;

public class Toolbar extends ViewGroup {
    private Drawable ʻ;
    private int ʻॱ;
    private TextView ʼ;
    private int ʼॱ;
    private ImageView ʽ;
    private CharSequence ʽॱ;
    private int ʾ;
    private int ʿ;
    private cv ˈ;
    private boolean ˉ;
    a ˊ;
    private boolean ˊˊ;
    private CharSequence ˊˋ;
    private int ˊॱ;
    private int ˊᐝ;
    int ˋ;
    private int ˋˊ;
    private final int[] ˋˋ;
    private CharSequence ˋॱ;
    private final c ˋᐝ;
    private final ArrayList<View> ˌ;
    private final ArrayList<View> ˍ;
    ImageButton ˎ;
    private cx ˎˎ;
    private o.bd.e ˎˏ;
    View ˏ;
    private e ˏˎ;
    private boolean ˏˏ;
    private int ˏॱ;
    private d ˑ;
    private int ͺ;
    private ActionMenuPresenter ͺॱ;
    private ActionMenuView ॱ;
    private final Runnable ॱʼ;
    private Context ॱˊ;
    private int ॱˋ;
    private int ॱˎ;
    private ImageButton ॱॱ;
    private int ॱᐝ;
    private TextView ᐝ;
    private int ᐝॱ;

    public static class LayoutParams extends androidx.appcompat.app.ActionBar.LayoutParams {
        int ˋ;

        public LayoutParams(@NonNull Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            this.ˋ = 0;
        }

        public LayoutParams(int i, int i2) {
            super(i, i2);
            this.ˋ = 0;
            this.ॱ = 8388627;
        }

        public LayoutParams(LayoutParams layoutParams) {
            super((androidx.appcompat.app.ActionBar.LayoutParams) layoutParams);
            this.ˋ = 0;
            this.ˋ = layoutParams.ˋ;
        }

        public LayoutParams(androidx.appcompat.app.ActionBar.LayoutParams layoutParams) {
            super(layoutParams);
            this.ˋ = 0;
        }

        public LayoutParams(MarginLayoutParams marginLayoutParams) {
            super((android.view.ViewGroup.LayoutParams) marginLayoutParams);
            this.ˋ = 0;
            ॱ(marginLayoutParams);
        }

        public LayoutParams(android.view.ViewGroup.LayoutParams layoutParams) {
            super(layoutParams);
            this.ˋ = 0;
        }

        void ॱ(MarginLayoutParams marginLayoutParams) {
            this.leftMargin = marginLayoutParams.leftMargin;
            this.topMargin = marginLayoutParams.topMargin;
            this.rightMargin = marginLayoutParams.rightMargin;
            this.bottomMargin = marginLayoutParams.bottomMargin;
        }
    }

    public static class SavedState extends AbsSavedState {
        public static final Creator<SavedState> CREATOR = new ClassLoaderCreator<SavedState>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return ˊ(parcel);
            }

            public /* synthetic */ Object createFromParcel(Parcel parcel, ClassLoader classLoader) {
                return ॱ(parcel, classLoader);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return ˊ(i);
            }

            public SavedState ॱ(Parcel parcel, ClassLoader classLoader) {
                return new SavedState(parcel, classLoader);
            }

            public SavedState ˊ(Parcel parcel) {
                return new SavedState(parcel, null);
            }

            public SavedState[] ˊ(int i) {
                return new SavedState[i];
            }
        };
        int ˎ;
        boolean ˏ;

        public SavedState(Parcel parcel, ClassLoader classLoader) {
            super(parcel, classLoader);
            this.ˎ = parcel.readInt();
            this.ˏ = parcel.readInt() != 0;
        }

        public SavedState(Parcelable parcelable) {
            super(parcelable);
        }

        public void writeToParcel(Parcel parcel, int i) {
            super.writeToParcel(parcel, i);
            parcel.writeInt(this.ˎ);
            parcel.writeInt(this.ˏ ? 1 : 0);
        }
    }

    public interface a {
        boolean ˏ(MenuItem menuItem);
    }

    class e implements bn {
        final /* synthetic */ Toolbar ˊ;
        bd ˏ;
        bj ॱ;

        e(Toolbar toolbar) {
            this.ˊ = toolbar;
        }

        public void ˏ(Context context, bd bdVar) {
            if (!(this.ˏ == null || this.ॱ == null)) {
                this.ˏ.ˎ(this.ॱ);
            }
            this.ˏ = bdVar;
        }

        public void ˊ(boolean z) {
            Object obj = null;
            if (this.ॱ != null) {
                if (this.ˏ != null) {
                    int size = this.ˏ.size();
                    for (int i = 0; i < size; i++) {
                        if (this.ˏ.getItem(i) == this.ॱ) {
                            obj = 1;
                            break;
                        }
                    }
                }
                if (obj == null) {
                    ˎ(this.ˏ, this.ॱ);
                }
            }
        }

        public void ˎ(d dVar) {
        }

        public boolean ˎ(bv bvVar) {
            return false;
        }

        public void ˏ(bd bdVar, boolean z) {
        }

        public boolean ˏ() {
            return false;
        }

        public boolean ˏ(bd bdVar, bj bjVar) {
            this.ˊ.ʾ();
            ViewParent parent = this.ˊ.ˎ.getParent();
            if (parent != this.ˊ) {
                if (parent instanceof ViewGroup) {
                    ((ViewGroup) parent).removeView(this.ˊ.ˎ);
                }
                this.ˊ.addView(this.ˊ.ˎ);
            }
            this.ˊ.ˏ = bjVar.getActionView();
            this.ॱ = bjVar;
            parent = this.ˊ.ˏ.getParent();
            if (parent != this.ˊ) {
                if (parent instanceof ViewGroup) {
                    ((ViewGroup) parent).removeView(this.ˊ.ˏ);
                }
                android.view.ViewGroup.LayoutParams ʼॱ = this.ˊ.ʼॱ();
                ʼॱ.ॱ = 8388611 | (this.ˊ.ˋ & 112);
                ʼॱ.ˋ = 2;
                this.ˊ.ˏ.setLayoutParams(ʼॱ);
                this.ˊ.addView(this.ˊ.ˏ);
            }
            this.ˊ.ˊˋ();
            this.ˊ.requestLayout();
            bjVar.ˎ(true);
            if (this.ˊ.ˏ instanceof at) {
                ((at) this.ˊ.ˏ).ˊ();
            }
            return true;
        }

        public boolean ˎ(bd bdVar, bj bjVar) {
            if (this.ˊ.ˏ instanceof at) {
                ((at) this.ˊ.ˏ).ˎ();
            }
            this.ˊ.removeView(this.ˊ.ˏ);
            this.ˊ.removeView(this.ˊ.ˎ);
            this.ˊ.ˏ = null;
            this.ˊ.ˊᐝ();
            this.ॱ = null;
            this.ˊ.requestLayout();
            bjVar.ˎ(false);
            return true;
        }

        public int ॱ() {
            return 0;
        }

        public Parcelable ʽ() {
            return null;
        }

        public void ˏ(Parcelable parcelable) {
        }
    }

    protected /* synthetic */ android.view.ViewGroup.LayoutParams generateDefaultLayoutParams() {
        return ʼॱ();
    }

    public /* synthetic */ android.view.ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
        return ॱ(attributeSet);
    }

    protected /* synthetic */ android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams layoutParams) {
        return ˏ(layoutParams);
    }

    public Toolbar(Context context) {
        this(context, null);
    }

    public Toolbar(Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, ah.c.ॱʽ);
    }

    public Toolbar(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.ʿ = 8388627;
        this.ˌ = new ArrayList();
        this.ˍ = new ArrayList();
        this.ˋˋ = new int[2];
        this.ˋᐝ = new c(this) {
            final /* synthetic */ Toolbar ˊ;

            {
                this.ˊ = r1;
            }

            public boolean ॱ(MenuItem menuItem) {
                if (this.ˊ.ˊ != null) {
                    return this.ˊ.ˊ.ˏ(menuItem);
                }
                return false;
            }
        };
        this.ॱʼ = new Runnable(this) {
            final /* synthetic */ Toolbar ॱ;

            {
                this.ॱ = r1;
            }

            public void run() {
                this.ॱ.ʼ();
            }
        };
        cw ॱ = cw.ॱ(getContext(), attributeSet, g.ॱᶫ, i, 0);
        this.ͺ = ॱ.ॱॱ(g.ᐝㆍ, 0);
        this.ˊॱ = ॱ.ॱॱ(g.ᐝꓸ, 0);
        this.ʿ = ॱ.ˏ(g.ॱᵢ, this.ʿ);
        this.ˋ = ॱ.ˏ(g.ᐠ, 48);
        int ˊ = ॱ.ˊ(g.ᐝᶥ, 0);
        if (ॱ.ᐝ(g.ᐝﹳ)) {
            ˊ = ॱ.ˊ(g.ᐝﹳ, ˊ);
        }
        this.ᐝॱ = ˊ;
        this.ʻॱ = ˊ;
        this.ॱˎ = ˊ;
        this.ॱˋ = ˊ;
        ˊ = ॱ.ˊ(g.ᐝꜞ, -1);
        if (ˊ >= 0) {
            this.ॱˋ = ˊ;
        }
        ˊ = ॱ.ˊ(g.ᐝꜟ, -1);
        if (ˊ >= 0) {
            this.ॱˎ = ˊ;
        }
        ˊ = ॱ.ˊ(g.ᐝﾞ, -1);
        if (ˊ >= 0) {
            this.ʻॱ = ˊ;
        }
        ˊ = ॱ.ˊ(g.ᐝﾟ, -1);
        if (ˊ >= 0) {
            this.ᐝॱ = ˊ;
        }
        this.ॱᐝ = ॱ.ˎ(g.ᐝꞌ, -1);
        ˊ = ॱ.ˊ(g.ᐝʿ, Integer.MIN_VALUE);
        int ˊ2 = ॱ.ˊ(g.ᐝʾ, Integer.MIN_VALUE);
        int ˎ = ॱ.ˎ(g.ᐝـ, 0);
        int ˎ2 = ॱ.ˎ(g.ᐝᐨ, 0);
        ˋᐝ();
        this.ˈ.ˊ(ˎ, ˎ2);
        if (!(ˊ == Integer.MIN_VALUE && ˊ2 == Integer.MIN_VALUE)) {
            this.ˈ.ॱ(ˊ, ˊ2);
        }
        this.ʾ = ॱ.ˊ(g.ᐝˑ, Integer.MIN_VALUE);
        this.ʼॱ = ॱ.ˊ(g.ᐝᐧ, Integer.MIN_VALUE);
        this.ʻ = ॱ.ˋ(g.ᐧᐝ);
        this.ˋॱ = ॱ.ˊ(g.ᐧˎ);
        CharSequence ˊ3 = ॱ.ˊ(g.ᐝˈ);
        if (!TextUtils.isEmpty(ˊ3)) {
            setTitle(ˊ3);
        }
        ˊ3 = ॱ.ˊ(g.ᐝˉ);
        if (!TextUtils.isEmpty(ˊ3)) {
            setSubtitle(ˊ3);
        }
        this.ॱˊ = getContext();
        setPopupTheme(ॱ.ॱॱ(g.ᐝˌ, 0));
        Drawable ˋ = ॱ.ˋ(g.ᐧˊ);
        if (ˋ != null) {
            setNavigationIcon(ˋ);
        }
        ˊ3 = ॱ.ˊ(g.ᐣ);
        if (!TextUtils.isEmpty(ˊ3)) {
            setNavigationContentDescription(ˊ3);
        }
        ˋ = ॱ.ˋ(g.ॱﹺ);
        if (ˋ != null) {
            setLogo(ˋ);
        }
        ˊ3 = ॱ.ˊ(g.ᐧˋ);
        if (!TextUtils.isEmpty(ˊ3)) {
            setLogoDescription(ˊ3);
        }
        if (ॱ.ᐝ(g.ᐨᐝ)) {
            setTitleTextColor(ॱ.ˋ(g.ᐨᐝ, -1));
        }
        if (ॱ.ᐝ(g.ᐩ)) {
            setSubtitleTextColor(ॱ.ˋ(g.ᐩ, -1));
        }
        ॱ.ॱ();
    }

    public void setPopupTheme(@StyleRes int i) {
        if (this.ˏॱ != i) {
            this.ˏॱ = i;
            if (i == 0) {
                this.ॱˊ = getContext();
            } else {
                this.ॱˊ = new ContextThemeWrapper(getContext(), i);
            }
        }
    }

    public void setTitleMargin(int i, int i2, int i3, int i4) {
        this.ॱˋ = i;
        this.ʻॱ = i2;
        this.ॱˎ = i3;
        this.ᐝॱ = i4;
        requestLayout();
    }

    public int ˊ() {
        return this.ॱˋ;
    }

    public void setTitleMarginStart(int i) {
        this.ॱˋ = i;
        requestLayout();
    }

    public int ˏ() {
        return this.ʻॱ;
    }

    public void setTitleMarginTop(int i) {
        this.ʻॱ = i;
        requestLayout();
    }

    public int ॱ() {
        return this.ॱˎ;
    }

    public void setTitleMarginEnd(int i) {
        this.ॱˎ = i;
        requestLayout();
    }

    public int ˋ() {
        return this.ᐝॱ;
    }

    public void setTitleMarginBottom(int i) {
        this.ᐝॱ = i;
        requestLayout();
    }

    public void onRtlPropertiesChanged(int i) {
        boolean z = true;
        if (VERSION.SDK_INT >= 17) {
            super.onRtlPropertiesChanged(i);
        }
        ˋᐝ();
        cv cvVar = this.ˈ;
        if (i != 1) {
            z = false;
        }
        cvVar.ˋ(z);
    }

    public void setLogo(@DrawableRes int i) {
        setLogo(ar.ˋ(getContext(), i));
    }

    @RestrictTo({RestrictTo.d.LIBRARY_GROUP})
    public boolean ˎ() {
        return getVisibility() == 0 && this.ॱ != null && this.ॱ.ˎ();
    }

    public boolean ॱॱ() {
        return this.ॱ != null && this.ॱ.ʼ();
    }

    @RestrictTo({RestrictTo.d.LIBRARY_GROUP})
    public boolean ʽ() {
        return this.ॱ != null && this.ॱ.ॱॱ();
    }

    public boolean ʼ() {
        return this.ॱ != null && this.ॱ.ʻ();
    }

    public boolean ʻ() {
        return this.ॱ != null && this.ॱ.ʽ();
    }

    @RestrictTo({RestrictTo.d.LIBRARY_GROUP})
    public void setMenu(bd bdVar, ActionMenuPresenter actionMenuPresenter) {
        if (bdVar != null || this.ॱ != null) {
            ˎˎ();
            bd ॱ = this.ॱ.ॱ();
            if (ॱ != bdVar) {
                if (ॱ != null) {
                    ॱ.ˏ(this.ͺॱ);
                    ॱ.ˏ(this.ˏˎ);
                }
                if (this.ˏˎ == null) {
                    this.ˏˎ = new e(this);
                }
                actionMenuPresenter.ˋ(true);
                if (bdVar != null) {
                    bdVar.ˏ(actionMenuPresenter, this.ॱˊ);
                    bdVar.ˏ(this.ˏˎ, this.ॱˊ);
                } else {
                    actionMenuPresenter.ˏ(this.ॱˊ, null);
                    this.ˏˎ.ˏ(this.ॱˊ, null);
                    actionMenuPresenter.ˊ(true);
                    this.ˏˎ.ˊ(true);
                }
                this.ॱ.setPopupTheme(this.ˏॱ);
                this.ॱ.setPresenter(actionMenuPresenter);
                this.ͺॱ = actionMenuPresenter;
            }
        }
    }

    public void ᐝ() {
        if (this.ॱ != null) {
            this.ॱ.ᐝ();
        }
    }

    public void setLogo(Drawable drawable) {
        if (drawable != null) {
            ˉ();
            if (!ॱ(this.ʽ)) {
                ˎ(this.ʽ, true);
            }
        } else if (this.ʽ != null && ॱ(this.ʽ)) {
            removeView(this.ʽ);
            this.ˍ.remove(this.ʽ);
        }
        if (this.ʽ != null) {
            this.ʽ.setImageDrawable(drawable);
        }
    }

    public void setLogoDescription(@StringRes int i) {
        setLogoDescription(getContext().getText(i));
    }

    public void setLogoDescription(CharSequence charSequence) {
        if (!TextUtils.isEmpty(charSequence)) {
            ˉ();
        }
        if (this.ʽ != null) {
            this.ʽ.setContentDescription(charSequence);
        }
    }

    private void ˉ() {
        if (this.ʽ == null) {
            this.ʽ = new AppCompatImageView(getContext());
        }
    }

    public boolean ˏॱ() {
        return (this.ˏˎ == null || this.ˏˎ.ॱ == null) ? false : true;
    }

    public void ˋॱ() {
        bj bjVar = this.ˏˎ == null ? null : this.ˏˎ.ॱ;
        if (bjVar != null) {
            bjVar.collapseActionView();
        }
    }

    public CharSequence ˊॱ() {
        return this.ʽॱ;
    }

    public void setTitle(@StringRes int i) {
        setTitle(getContext().getText(i));
    }

    public void setTitle(CharSequence charSequence) {
        if (!TextUtils.isEmpty(charSequence)) {
            if (this.ᐝ == null) {
                Context context = getContext();
                this.ᐝ = new AppCompatTextView(context);
                this.ᐝ.setSingleLine();
                this.ᐝ.setEllipsize(TruncateAt.END);
                if (this.ͺ != 0) {
                    this.ᐝ.setTextAppearance(context, this.ͺ);
                }
                if (this.ˋˊ != 0) {
                    this.ᐝ.setTextColor(this.ˋˊ);
                }
            }
            if (!ॱ(this.ᐝ)) {
                ˎ(this.ᐝ, true);
            }
        } else if (this.ᐝ != null && ॱ(this.ᐝ)) {
            removeView(this.ᐝ);
            this.ˍ.remove(this.ᐝ);
        }
        if (this.ᐝ != null) {
            this.ᐝ.setText(charSequence);
        }
        this.ʽॱ = charSequence;
    }

    public CharSequence ॱˊ() {
        return this.ˊˋ;
    }

    public void setSubtitle(@StringRes int i) {
        setSubtitle(getContext().getText(i));
    }

    public void setSubtitle(CharSequence charSequence) {
        if (!TextUtils.isEmpty(charSequence)) {
            if (this.ʼ == null) {
                Context context = getContext();
                this.ʼ = new AppCompatTextView(context);
                this.ʼ.setSingleLine();
                this.ʼ.setEllipsize(TruncateAt.END);
                if (this.ˊॱ != 0) {
                    this.ʼ.setTextAppearance(context, this.ˊॱ);
                }
                if (this.ˊᐝ != 0) {
                    this.ʼ.setTextColor(this.ˊᐝ);
                }
            }
            if (!ॱ(this.ʼ)) {
                ˎ(this.ʼ, true);
            }
        } else if (this.ʼ != null && ॱ(this.ʼ)) {
            removeView(this.ʼ);
            this.ˍ.remove(this.ʼ);
        }
        if (this.ʼ != null) {
            this.ʼ.setText(charSequence);
        }
        this.ˊˋ = charSequence;
    }

    public void setTitleTextAppearance(Context context, @StyleRes int i) {
        this.ͺ = i;
        if (this.ᐝ != null) {
            this.ᐝ.setTextAppearance(context, i);
        }
    }

    public void setSubtitleTextAppearance(Context context, @StyleRes int i) {
        this.ˊॱ = i;
        if (this.ʼ != null) {
            this.ʼ.setTextAppearance(context, i);
        }
    }

    public void setTitleTextColor(@ColorInt int i) {
        this.ˋˊ = i;
        if (this.ᐝ != null) {
            this.ᐝ.setTextColor(i);
        }
    }

    public void setSubtitleTextColor(@ColorInt int i) {
        this.ˊᐝ = i;
        if (this.ʼ != null) {
            this.ʼ.setTextColor(i);
        }
    }

    @Nullable
    public CharSequence ͺ() {
        return this.ॱॱ != null ? this.ॱॱ.getContentDescription() : null;
    }

    public void setNavigationContentDescription(@StringRes int i) {
        setNavigationContentDescription(i != 0 ? getContext().getText(i) : null);
    }

    public void setNavigationContentDescription(@Nullable CharSequence charSequence) {
        if (!TextUtils.isEmpty(charSequence)) {
            ˋˋ();
        }
        if (this.ॱॱ != null) {
            this.ॱॱ.setContentDescription(charSequence);
        }
    }

    public void setNavigationIcon(@DrawableRes int i) {
        setNavigationIcon(ar.ˋ(getContext(), i));
    }

    public void setNavigationIcon(@Nullable Drawable drawable) {
        if (drawable != null) {
            ˋˋ();
            if (!ॱ(this.ॱॱ)) {
                ˎ(this.ॱॱ, true);
            }
        } else if (this.ॱॱ != null && ॱ(this.ॱॱ)) {
            removeView(this.ॱॱ);
            this.ˍ.remove(this.ॱॱ);
        }
        if (this.ॱॱ != null) {
            this.ॱॱ.setImageDrawable(drawable);
        }
    }

    @Nullable
    public Drawable ॱˎ() {
        return this.ॱॱ != null ? this.ॱॱ.getDrawable() : null;
    }

    public void setNavigationOnClickListener(OnClickListener onClickListener) {
        ˋˋ();
        this.ॱॱ.setOnClickListener(onClickListener);
    }

    public Menu ॱᐝ() {
        ˊˊ();
        return this.ॱ.ˋ();
    }

    public void setOverflowIcon(@Nullable Drawable drawable) {
        ˊˊ();
        this.ॱ.setOverflowIcon(drawable);
    }

    private void ˊˊ() {
        ˎˎ();
        if (this.ॱ.ॱ() == null) {
            bd bdVar = (bd) this.ॱ.ˋ();
            if (this.ˏˎ == null) {
                this.ˏˎ = new e(this);
            }
            this.ॱ.setExpandedActionViewsExclusive(true);
            bdVar.ˏ(this.ˏˎ, this.ॱˊ);
        }
    }

    private void ˎˎ() {
        if (this.ॱ == null) {
            this.ॱ = new ActionMenuView(getContext());
            this.ॱ.setPopupTheme(this.ˏॱ);
            this.ॱ.setOnMenuItemClickListener(this.ˋᐝ);
            this.ॱ.setMenuCallbacks(this.ˑ, this.ˎˏ);
            android.view.ViewGroup.LayoutParams ʼॱ = ʼॱ();
            ʼॱ.ॱ = 8388613 | (this.ˋ & 112);
            this.ॱ.setLayoutParams(ʼॱ);
            ˎ(this.ॱ, false);
        }
    }

    public void setOnMenuItemClickListener(a aVar) {
        this.ˊ = aVar;
    }

    public void setContentInsetsRelative(int i, int i2) {
        ˋᐝ();
        this.ˈ.ॱ(i, i2);
    }

    public int ॱˋ() {
        return this.ˈ != null ? this.ˈ.ˎ() : 0;
    }

    public int ᐝॱ() {
        return this.ˈ != null ? this.ˈ.ˋ() : 0;
    }

    public void setContentInsetsAbsolute(int i, int i2) {
        ˋᐝ();
        this.ˈ.ˊ(i, i2);
    }

    public void setContentInsetStartWithNavigation(int i) {
        if (i < 0) {
            i = Integer.MIN_VALUE;
        }
        if (i != this.ʾ) {
            this.ʾ = i;
            if (ॱˎ() != null) {
                requestLayout();
            }
        }
    }

    public void setContentInsetEndWithActions(int i) {
        if (i < 0) {
            i = Integer.MIN_VALUE;
        }
        if (i != this.ʼॱ) {
            this.ʼॱ = i;
            if (ॱˎ() != null) {
                requestLayout();
            }
        }
    }

    public int ʻॱ() {
        if (ॱˎ() != null) {
            return Math.max(ॱˋ(), Math.max(this.ʾ, 0));
        }
        return ॱˋ();
    }

    public int ʽॱ() {
        int i;
        if (this.ॱ != null) {
            bd ॱ = this.ॱ.ॱ();
            i = (ॱ == null || !ॱ.hasVisibleItems()) ? 0 : 1;
        } else {
            i = 0;
        }
        if (i != 0) {
            return Math.max(ᐝॱ(), Math.max(this.ʼॱ, 0));
        }
        return ᐝॱ();
    }

    public int ʿ() {
        if (ViewCompat.ʼ(this) == 1) {
            return ʽॱ();
        }
        return ʻॱ();
    }

    public int ˈ() {
        if (ViewCompat.ʼ(this) == 1) {
            return ʻॱ();
        }
        return ʽॱ();
    }

    private void ˋˋ() {
        if (this.ॱॱ == null) {
            this.ॱॱ = new AppCompatImageButton(getContext(), null, ah.c.ـ);
            android.view.ViewGroup.LayoutParams ʼॱ = ʼॱ();
            ʼॱ.ॱ = 8388611 | (this.ˋ & 112);
            this.ॱॱ.setLayoutParams(ʼॱ);
        }
    }

    void ʾ() {
        if (this.ˎ == null) {
            this.ˎ = new AppCompatImageButton(getContext(), null, ah.c.ـ);
            this.ˎ.setImageDrawable(this.ʻ);
            this.ˎ.setContentDescription(this.ˋॱ);
            android.view.ViewGroup.LayoutParams ʼॱ = ʼॱ();
            ʼॱ.ॱ = 8388611 | (this.ˋ & 112);
            ʼॱ.ˋ = 2;
            this.ˎ.setLayoutParams(ʼॱ);
            this.ˎ.setOnClickListener(new OnClickListener(this) {
                final /* synthetic */ Toolbar ˊ;

                {
                    this.ˊ = r1;
                }

                public void onClick(View view) {
                    this.ˊ.ˋॱ();
                }
            });
        }
    }

    private void ˎ(View view, boolean z) {
        android.view.ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (layoutParams == null) {
            layoutParams = ʼॱ();
        } else if (checkLayoutParams(layoutParams)) {
            LayoutParams layoutParams2 = (LayoutParams) layoutParams;
        } else {
            layoutParams = ˏ(layoutParams);
        }
        layoutParams.ˋ = 1;
        if (!z || this.ˏ == null) {
            addView(view, layoutParams);
            return;
        }
        view.setLayoutParams(layoutParams);
        this.ˍ.add(view);
    }

    protected Parcelable onSaveInstanceState() {
        Parcelable savedState = new SavedState(super.onSaveInstanceState());
        if (!(this.ˏˎ == null || this.ˏˎ.ॱ == null)) {
            savedState.ˎ = this.ˏˎ.ॱ.getItemId();
        }
        savedState.ˏ = ॱॱ();
        return savedState;
    }

    protected void onRestoreInstanceState(Parcelable parcelable) {
        if (parcelable instanceof SavedState) {
            SavedState savedState = (SavedState) parcelable;
            super.onRestoreInstanceState(savedState.ˊ());
            Menu ॱ = this.ॱ != null ? this.ॱ.ॱ() : null;
            if (!(savedState.ˎ == 0 || this.ˏˎ == null || ॱ == null)) {
                MenuItem findItem = ॱ.findItem(savedState.ˎ);
                if (findItem != null) {
                    findItem.expandActionView();
                }
            }
            if (savedState.ˏ) {
                ˌ();
                return;
            }
            return;
        }
        super.onRestoreInstanceState(parcelable);
    }

    private void ˌ() {
        removeCallbacks(this.ॱʼ);
        post(this.ॱʼ);
    }

    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        removeCallbacks(this.ॱʼ);
    }

    public boolean onTouchEvent(MotionEvent motionEvent) {
        int actionMasked = motionEvent.getActionMasked();
        if (actionMasked == 0) {
            this.ˉ = false;
        }
        if (!this.ˉ) {
            boolean onTouchEvent = super.onTouchEvent(motionEvent);
            if (actionMasked == 0 && !onTouchEvent) {
                this.ˉ = true;
            }
        }
        if (actionMasked == 1 || actionMasked == 3) {
            this.ˉ = false;
        }
        return true;
    }

    public boolean onHoverEvent(MotionEvent motionEvent) {
        int actionMasked = motionEvent.getActionMasked();
        if (actionMasked == 9) {
            this.ˊˊ = false;
        }
        if (!this.ˊˊ) {
            boolean onHoverEvent = super.onHoverEvent(motionEvent);
            if (actionMasked == 9 && !onHoverEvent) {
                this.ˊˊ = true;
            }
        }
        if (actionMasked == 10 || actionMasked == 3) {
            this.ˊˊ = false;
        }
        return true;
    }

    private void ॱ(View view, int i, int i2, int i3, int i4, int i5) {
        MarginLayoutParams marginLayoutParams = (MarginLayoutParams) view.getLayoutParams();
        int childMeasureSpec = getChildMeasureSpec(i, (((getPaddingLeft() + getPaddingRight()) + marginLayoutParams.leftMargin) + marginLayoutParams.rightMargin) + i2, marginLayoutParams.width);
        int childMeasureSpec2 = getChildMeasureSpec(i3, (((getPaddingTop() + getPaddingBottom()) + marginLayoutParams.topMargin) + marginLayoutParams.bottomMargin) + i4, marginLayoutParams.height);
        int mode = MeasureSpec.getMode(childMeasureSpec2);
        if (mode != 1073741824 && i5 >= 0) {
            if (mode != 0) {
                i5 = Math.min(MeasureSpec.getSize(childMeasureSpec2), i5);
            }
            childMeasureSpec2 = MeasureSpec.makeMeasureSpec(i5, 1073741824);
        }
        view.measure(childMeasureSpec, childMeasureSpec2);
    }

    private int ˊ(View view, int i, int i2, int i3, int i4, int[] iArr) {
        MarginLayoutParams marginLayoutParams = (MarginLayoutParams) view.getLayoutParams();
        int i5 = marginLayoutParams.leftMargin - iArr[0];
        int i6 = marginLayoutParams.rightMargin - iArr[1];
        int max = Math.max(0, i5) + Math.max(0, i6);
        iArr[0] = Math.max(0, -i5);
        iArr[1] = Math.max(0, -i6);
        view.measure(getChildMeasureSpec(i, ((getPaddingLeft() + getPaddingRight()) + max) + i2, marginLayoutParams.width), getChildMeasureSpec(i3, (((getPaddingTop() + getPaddingBottom()) + marginLayoutParams.topMargin) + marginLayoutParams.bottomMargin) + i4, marginLayoutParams.height));
        return view.getMeasuredWidth() + max;
    }

    private boolean ˍ() {
        if (!this.ˏˏ) {
            return false;
        }
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View childAt = getChildAt(i);
            if (ˏ(childAt) && childAt.getMeasuredWidth() > 0 && childAt.getMeasuredHeight() > 0) {
                return false;
            }
        }
        return true;
    }

    protected void onMeasure(int i, int i2) {
        int i3;
        int i4;
        int max;
        int i5 = 0;
        int i6 = 0;
        int[] iArr = this.ˋˋ;
        if (de.ˎ(this)) {
            i3 = 0;
            i4 = 1;
        } else {
            i3 = 1;
            i4 = 0;
        }
        int i7 = 0;
        if (ˏ(this.ॱॱ)) {
            ॱ(this.ॱॱ, i, 0, i2, 0, this.ॱᐝ);
            i7 = this.ॱॱ.getMeasuredWidth() + ˋ(this.ॱॱ);
            max = Math.max(0, this.ॱॱ.getMeasuredHeight() + ˎ(this.ॱॱ));
            i6 = View.combineMeasuredStates(0, this.ॱॱ.getMeasuredState());
            i5 = max;
        }
        if (ˏ(this.ˎ)) {
            ॱ(this.ˎ, i, 0, i2, 0, this.ॱᐝ);
            i7 = this.ˎ.getMeasuredWidth() + ˋ(this.ˎ);
            i5 = Math.max(i5, this.ˎ.getMeasuredHeight() + ˎ(this.ˎ));
            i6 = View.combineMeasuredStates(i6, this.ˎ.getMeasuredState());
        }
        int ʻॱ = ʻॱ();
        int max2 = 0 + Math.max(ʻॱ, i7);
        iArr[i4] = Math.max(0, ʻॱ - i7);
        i7 = 0;
        if (ˏ(this.ॱ)) {
            ॱ(this.ॱ, i, max2, i2, 0, this.ॱᐝ);
            i7 = this.ॱ.getMeasuredWidth() + ˋ(this.ॱ);
            i5 = Math.max(i5, this.ॱ.getMeasuredHeight() + ˎ(this.ॱ));
            i6 = View.combineMeasuredStates(i6, this.ॱ.getMeasuredState());
        }
        ʻॱ = ʽॱ();
        max2 += Math.max(ʻॱ, i7);
        iArr[i3] = Math.max(0, ʻॱ - i7);
        if (ˏ(this.ˏ)) {
            max2 += ˊ(this.ˏ, i, max2, i2, 0, iArr);
            i5 = Math.max(i5, this.ˏ.getMeasuredHeight() + ˎ(this.ˏ));
            i6 = View.combineMeasuredStates(i6, this.ˏ.getMeasuredState());
        }
        if (ˏ(this.ʽ)) {
            max2 += ˊ(this.ʽ, i, max2, i2, 0, iArr);
            i5 = Math.max(i5, this.ʽ.getMeasuredHeight() + ˎ(this.ʽ));
            i6 = View.combineMeasuredStates(i6, this.ʽ.getMeasuredState());
        }
        i4 = getChildCount();
        i3 = 0;
        int i8 = i5;
        i5 = i6;
        while (i3 < i4) {
            View childAt = getChildAt(i3);
            if (((LayoutParams) childAt.getLayoutParams()).ˋ != 0) {
                i7 = i5;
                ʻॱ = i8;
            } else if (ˏ(childAt)) {
                max2 += ˊ(childAt, i, max2, i2, 0, iArr);
                max = Math.max(i8, childAt.getMeasuredHeight() + ˎ(childAt));
                i7 = View.combineMeasuredStates(i5, childAt.getMeasuredState());
                ʻॱ = max;
            } else {
                i7 = i5;
                ʻॱ = i8;
            }
            i3++;
            i5 = i7;
            i8 = ʻॱ;
        }
        ʻॱ = 0;
        i7 = 0;
        i6 = this.ʻॱ + this.ᐝॱ;
        max = this.ॱˋ + this.ॱˎ;
        if (ˏ(this.ᐝ)) {
            ˊ(this.ᐝ, i, max2 + max, i2, i6, iArr);
            ʻॱ = ˋ(this.ᐝ) + this.ᐝ.getMeasuredWidth();
            i7 = this.ᐝ.getMeasuredHeight() + ˎ(this.ᐝ);
            i5 = View.combineMeasuredStates(i5, this.ᐝ.getMeasuredState());
        }
        if (ˏ(this.ʼ)) {
            ʻॱ = Math.max(ʻॱ, ˊ(this.ʼ, i, max2 + max, i2, i6 + i7, iArr));
            i7 += this.ʼ.getMeasuredHeight() + ˎ(this.ʼ);
            i5 = View.combineMeasuredStates(i5, this.ʼ.getMeasuredState());
        }
        ʻॱ += max2;
        i7 = Math.max(i8, i7) + (getPaddingTop() + getPaddingBottom());
        ʻॱ = View.resolveSizeAndState(Math.max(ʻॱ + (getPaddingLeft() + getPaddingRight()), getSuggestedMinimumWidth()), i, -16777216 & i5);
        i7 = View.resolveSizeAndState(Math.max(i7, getSuggestedMinimumHeight()), i2, i5 << 16);
        if (ˍ()) {
            i7 = 0;
        }
        setMeasuredDimension(ʻॱ, i7);
    }

    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        Object obj;
        int measuredHeight;
        int measuredWidth;
        if (ViewCompat.ʼ(this) == 1) {
            obj = 1;
        } else {
            obj = null;
        }
        int width = getWidth();
        int height = getHeight();
        int paddingLeft = getPaddingLeft();
        int paddingRight = getPaddingRight();
        int paddingTop = getPaddingTop();
        int paddingBottom = getPaddingBottom();
        int i5 = width - paddingRight;
        int[] iArr = this.ˋˋ;
        iArr[1] = 0;
        iArr[0] = 0;
        int ˋॱ = ViewCompat.ˋॱ(this);
        int min = ˋॱ >= 0 ? Math.min(ˋॱ, i4 - i2) : 0;
        if (!ˏ(this.ॱॱ)) {
            ˋॱ = i5;
            i5 = paddingLeft;
        } else if (obj != null) {
            ˋॱ = ˊ(this.ॱॱ, i5, iArr, min);
            i5 = paddingLeft;
        } else {
            int i6 = i5;
            i5 = ॱ(this.ॱॱ, paddingLeft, iArr, min);
            ˋॱ = i6;
        }
        if (ˏ(this.ˎ)) {
            if (obj != null) {
                ˋॱ = ˊ(this.ˎ, ˋॱ, iArr, min);
            } else {
                i5 = ॱ(this.ˎ, i5, iArr, min);
            }
        }
        if (ˏ(this.ॱ)) {
            if (obj != null) {
                i5 = ॱ(this.ॱ, i5, iArr, min);
            } else {
                ˋॱ = ˊ(this.ॱ, ˋॱ, iArr, min);
            }
        }
        int ʿ = ʿ();
        int ˈ = ˈ();
        iArr[0] = Math.max(0, ʿ - i5);
        iArr[1] = Math.max(0, ˈ - ((width - paddingRight) - ˋॱ));
        i5 = Math.max(i5, ʿ);
        ˋॱ = Math.min(ˋॱ, (width - paddingRight) - ˈ);
        if (ˏ(this.ˏ)) {
            if (obj != null) {
                ˋॱ = ˊ(this.ˏ, ˋॱ, iArr, min);
            } else {
                i5 = ॱ(this.ˏ, i5, iArr, min);
            }
        }
        if (!ˏ(this.ʽ)) {
            ʿ = ˋॱ;
            ˈ = i5;
        } else if (obj != null) {
            ʿ = ˊ(this.ʽ, ˋॱ, iArr, min);
            ˈ = i5;
        } else {
            ʿ = ˋॱ;
            ˈ = ॱ(this.ʽ, i5, iArr, min);
        }
        boolean ˏ = ˏ(this.ᐝ);
        boolean ˏ2 = ˏ(this.ʼ);
        i5 = 0;
        if (ˏ) {
            LayoutParams layoutParams = (LayoutParams) this.ᐝ.getLayoutParams();
            i5 = 0 + (layoutParams.bottomMargin + (layoutParams.topMargin + this.ᐝ.getMeasuredHeight()));
        }
        if (ˏ2) {
            layoutParams = (LayoutParams) this.ʼ.getLayoutParams();
            measuredHeight = (layoutParams.bottomMargin + (layoutParams.topMargin + this.ʼ.getMeasuredHeight())) + i5;
        } else {
            measuredHeight = i5;
        }
        if (ˏ || ˏ2) {
            int paddingTop2;
            layoutParams = (LayoutParams) (ˏ ? this.ᐝ : this.ʼ).getLayoutParams();
            LayoutParams layoutParams2 = (LayoutParams) (ˏ2 ? this.ʼ : this.ᐝ).getLayoutParams();
            Object obj2 = ((!ˏ || this.ᐝ.getMeasuredWidth() <= 0) && (!ˏ2 || this.ʼ.getMeasuredWidth() <= 0)) ? null : 1;
            switch (this.ʿ & 112) {
                case 48:
                    paddingTop2 = (layoutParams.topMargin + getPaddingTop()) + this.ʻॱ;
                    break;
                case 80:
                    paddingTop2 = (((height - paddingBottom) - layoutParams2.bottomMargin) - this.ᐝॱ) - measuredHeight;
                    break;
                default:
                    paddingTop2 = (((height - paddingTop) - paddingBottom) - measuredHeight) / 2;
                    if (paddingTop2 < layoutParams.topMargin + this.ʻॱ) {
                        ˋॱ = layoutParams.topMargin + this.ʻॱ;
                    } else {
                        measuredHeight = (((height - paddingBottom) - measuredHeight) - paddingTop2) - paddingTop;
                        if (measuredHeight < layoutParams.bottomMargin + this.ᐝॱ) {
                            ˋॱ = Math.max(0, paddingTop2 - ((layoutParams2.bottomMargin + this.ᐝॱ) - measuredHeight));
                        } else {
                            ˋॱ = paddingTop2;
                        }
                    }
                    paddingTop2 = paddingTop + ˋॱ;
                    break;
            }
            if (obj != null) {
                ˋॱ = (obj2 != null ? this.ॱˋ : 0) - iArr[1];
                i5 = ʿ - Math.max(0, ˋॱ);
                iArr[1] = Math.max(0, -ˋॱ);
                if (ˏ) {
                    layoutParams = (LayoutParams) this.ᐝ.getLayoutParams();
                    measuredWidth = i5 - this.ᐝ.getMeasuredWidth();
                    ʿ = this.ᐝ.getMeasuredHeight() + paddingTop2;
                    this.ᐝ.layout(measuredWidth, paddingTop2, i5, ʿ);
                    paddingTop2 = ʿ + layoutParams.bottomMargin;
                    ʿ = measuredWidth - this.ॱˎ;
                } else {
                    ʿ = i5;
                }
                if (ˏ2) {
                    layoutParams = (LayoutParams) this.ʼ.getLayoutParams();
                    measuredWidth = layoutParams.topMargin + paddingTop2;
                    measuredHeight = this.ʼ.getMeasuredHeight() + measuredWidth;
                    this.ʼ.layout(i5 - this.ʼ.getMeasuredWidth(), measuredWidth, i5, measuredHeight);
                    ˋॱ = layoutParams.bottomMargin + measuredHeight;
                    ˋॱ = i5 - this.ॱˎ;
                } else {
                    ˋॱ = i5;
                }
                if (obj2 != null) {
                    ˋॱ = Math.min(ʿ, ˋॱ);
                } else {
                    ˋॱ = i5;
                }
                ʿ = ˋॱ;
            } else {
                ˋॱ = (obj2 != null ? this.ॱˋ : 0) - iArr[0];
                ˈ += Math.max(0, ˋॱ);
                iArr[0] = Math.max(0, -ˋॱ);
                if (ˏ) {
                    layoutParams = (LayoutParams) this.ᐝ.getLayoutParams();
                    i5 = this.ᐝ.getMeasuredWidth() + ˈ;
                    measuredWidth = this.ᐝ.getMeasuredHeight() + paddingTop2;
                    this.ᐝ.layout(ˈ, paddingTop2, i5, measuredWidth);
                    ˋॱ = layoutParams.bottomMargin + measuredWidth;
                    measuredWidth = i5 + this.ॱˎ;
                    i5 = ˋॱ;
                } else {
                    measuredWidth = ˈ;
                    i5 = paddingTop2;
                }
                if (ˏ2) {
                    layoutParams = (LayoutParams) this.ʼ.getLayoutParams();
                    i5 += layoutParams.topMargin;
                    paddingTop2 = this.ʼ.getMeasuredWidth() + ˈ;
                    measuredHeight = this.ʼ.getMeasuredHeight() + i5;
                    this.ʼ.layout(ˈ, i5, paddingTop2, measuredHeight);
                    ˋॱ = layoutParams.bottomMargin + measuredHeight;
                    ˋॱ = this.ॱˎ + paddingTop2;
                } else {
                    ˋॱ = ˈ;
                }
                if (obj2 != null) {
                    ˈ = Math.max(measuredWidth, ˋॱ);
                }
            }
        }
        ॱ(this.ˌ, 3);
        int size = this.ˌ.size();
        i5 = ˈ;
        for (measuredWidth = 0; measuredWidth < size; measuredWidth++) {
            i5 = ॱ((View) this.ˌ.get(measuredWidth), i5, iArr, min);
        }
        ॱ(this.ˌ, 5);
        ˈ = this.ˌ.size();
        for (measuredWidth = 0; measuredWidth < ˈ; measuredWidth++) {
            ʿ = ˊ((View) this.ˌ.get(measuredWidth), ʿ, iArr, min);
        }
        ॱ(this.ˌ, 1);
        measuredWidth = ˊ(this.ˌ, iArr);
        ˋॱ = ((((width - paddingLeft) - paddingRight) / 2) + paddingLeft) - (measuredWidth / 2);
        measuredWidth += ˋॱ;
        if (ˋॱ < i5) {
            ˋॱ = i5;
        } else if (measuredWidth > ʿ) {
            ˋॱ -= measuredWidth - ʿ;
        }
        paddingLeft = this.ˌ.size();
        measuredWidth = ˋॱ;
        for (i5 = 0; i5 < paddingLeft; i5++) {
            measuredWidth = ॱ((View) this.ˌ.get(i5), measuredWidth, iArr, min);
        }
        this.ˌ.clear();
    }

    private int ˊ(List<View> list, int[] iArr) {
        int i = iArr[0];
        int i2 = iArr[1];
        int size = list.size();
        int i3 = 0;
        int i4 = 0;
        int i5 = i2;
        int i6 = i;
        while (i3 < size) {
            View view = (View) list.get(i3);
            LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
            i6 = layoutParams.leftMargin - i6;
            i = layoutParams.rightMargin - i5;
            int max = Math.max(0, i6);
            int max2 = Math.max(0, i);
            i6 = Math.max(0, -i6);
            i5 = Math.max(0, -i);
            i3++;
            i4 += (view.getMeasuredWidth() + max) + max2;
        }
        return i4;
    }

    private int ॱ(View view, int i, int[] iArr, int i2) {
        LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
        int i3 = layoutParams.leftMargin - iArr[0];
        int max = Math.max(0, i3) + i;
        iArr[0] = Math.max(0, -i3);
        i3 = ॱ(view, i2);
        int measuredWidth = view.getMeasuredWidth();
        view.layout(max, i3, max + measuredWidth, view.getMeasuredHeight() + i3);
        return (layoutParams.rightMargin + measuredWidth) + max;
    }

    private int ˊ(View view, int i, int[] iArr, int i2) {
        LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
        int i3 = layoutParams.rightMargin - iArr[1];
        int max = i - Math.max(0, i3);
        iArr[1] = Math.max(0, -i3);
        i3 = ॱ(view, i2);
        int measuredWidth = view.getMeasuredWidth();
        view.layout(max - measuredWidth, i3, max, view.getMeasuredHeight() + i3);
        return max - (layoutParams.leftMargin + measuredWidth);
    }

    private int ॱ(View view, int i) {
        LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
        int measuredHeight = view.getMeasuredHeight();
        int i2 = i > 0 ? (measuredHeight - i) / 2 : 0;
        switch (ˎ(layoutParams.ॱ)) {
            case 48:
                return getPaddingTop() - i2;
            case 80:
                return (((getHeight() - getPaddingBottom()) - measuredHeight) - layoutParams.bottomMargin) - i2;
            default:
                int i3;
                int paddingTop = getPaddingTop();
                int paddingBottom = getPaddingBottom();
                int height = getHeight();
                i2 = (((height - paddingTop) - paddingBottom) - measuredHeight) / 2;
                if (i2 < layoutParams.topMargin) {
                    i3 = layoutParams.topMargin;
                } else {
                    measuredHeight = (((height - paddingBottom) - measuredHeight) - i2) - paddingTop;
                    i3 = measuredHeight < layoutParams.bottomMargin ? Math.max(0, i2 - (layoutParams.bottomMargin - measuredHeight)) : i2;
                }
                return i3 + paddingTop;
        }
    }

    private int ˎ(int i) {
        int i2 = i & 112;
        switch (i2) {
            case 16:
            case 48:
            case 80:
                return i2;
            default:
                return this.ʿ & 112;
        }
    }

    private void ॱ(List<View> list, int i) {
        int i2 = 1;
        int i3 = 0;
        if (ViewCompat.ʼ(this) != 1) {
            i2 = 0;
        }
        int childCount = getChildCount();
        int ˎ = hj.ˎ(i, ViewCompat.ʼ(this));
        list.clear();
        LayoutParams layoutParams;
        if (i2 != 0) {
            for (i3 = childCount - 1; i3 >= 0; i3--) {
                View childAt = getChildAt(i3);
                layoutParams = (LayoutParams) childAt.getLayoutParams();
                if (layoutParams.ˋ == 0 && ˏ(childAt) && ˊ(layoutParams.ॱ) == ˎ) {
                    list.add(childAt);
                }
            }
            return;
        }
        while (i3 < childCount) {
            View childAt2 = getChildAt(i3);
            layoutParams = (LayoutParams) childAt2.getLayoutParams();
            if (layoutParams.ˋ == 0 && ˏ(childAt2) && ˊ(layoutParams.ॱ) == ˎ) {
                list.add(childAt2);
            }
            i3++;
        }
    }

    private int ˊ(int i) {
        int ʼ = ViewCompat.ʼ(this);
        int ˎ = hj.ˎ(i, ʼ) & 7;
        switch (ˎ) {
            case 1:
            case 3:
            case 5:
                return ˎ;
            default:
                return ʼ == 1 ? 5 : 3;
        }
    }

    private boolean ˏ(View view) {
        return (view == null || view.getParent() != this || view.getVisibility() == 8) ? false : true;
    }

    private int ˋ(View view) {
        MarginLayoutParams marginLayoutParams = (MarginLayoutParams) view.getLayoutParams();
        return hi.ॱ(marginLayoutParams) + hi.ˋ(marginLayoutParams);
    }

    private int ˎ(View view) {
        MarginLayoutParams marginLayoutParams = (MarginLayoutParams) view.getLayoutParams();
        return marginLayoutParams.bottomMargin + marginLayoutParams.topMargin;
    }

    public LayoutParams ॱ(AttributeSet attributeSet) {
        return new LayoutParams(getContext(), attributeSet);
    }

    protected LayoutParams ˏ(android.view.ViewGroup.LayoutParams layoutParams) {
        if (layoutParams instanceof LayoutParams) {
            return new LayoutParams((LayoutParams) layoutParams);
        }
        if (layoutParams instanceof androidx.appcompat.app.ActionBar.LayoutParams) {
            return new LayoutParams((androidx.appcompat.app.ActionBar.LayoutParams) layoutParams);
        }
        if (layoutParams instanceof MarginLayoutParams) {
            return new LayoutParams((MarginLayoutParams) layoutParams);
        }
        return new LayoutParams(layoutParams);
    }

    protected LayoutParams ʼॱ() {
        return new LayoutParams(-2, -2);
    }

    protected boolean checkLayoutParams(android.view.ViewGroup.LayoutParams layoutParams) {
        return super.checkLayoutParams(layoutParams) && (layoutParams instanceof LayoutParams);
    }

    @RestrictTo({RestrictTo.d.LIBRARY_GROUP})
    public ck ˋˊ() {
        if (this.ˎˎ == null) {
            this.ˎˎ = new cx(this, true);
        }
        return this.ˎˎ;
    }

    void ˊˋ() {
        for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
            View childAt = getChildAt(childCount);
            if (!(((LayoutParams) childAt.getLayoutParams()).ˋ == 2 || childAt == this.ॱ)) {
                removeViewAt(childCount);
                this.ˍ.add(childAt);
            }
        }
    }

    void ˊᐝ() {
        for (int size = this.ˍ.size() - 1; size >= 0; size--) {
            addView((View) this.ˍ.get(size));
        }
        this.ˍ.clear();
    }

    private boolean ॱ(View view) {
        return view.getParent() == this || this.ˍ.contains(view);
    }

    @RestrictTo({RestrictTo.d.LIBRARY_GROUP})
    public void setCollapsible(boolean z) {
        this.ˏˏ = z;
        requestLayout();
    }

    @RestrictTo({RestrictTo.d.LIBRARY_GROUP})
    public void setMenuCallbacks(d dVar, o.bd.e eVar) {
        this.ˑ = dVar;
        this.ˎˏ = eVar;
        if (this.ॱ != null) {
            this.ॱ.setMenuCallbacks(dVar, eVar);
        }
    }

    private void ˋᐝ() {
        if (this.ˈ == null) {
            this.ˈ = new cv();
        }
    }
}
